<template>
  <div class="consultation-order-management">
    <div class="page-header">
      <h2>问诊单管理</h2>
      <p>管理所有问诊单信息，包括待支付、进行中、已完成、已取消、已退诊等状态</p>
    </div>

    <!-- 筛选区域 -->
    <div class="filter-section">
      <div class="filter-header">
        <i class="filter-icon">📊</i>
        <span>筛选</span>
      </div>
      
      <div class="filter-content">
        <div class="filter-row">
          <div class="filter-item">
            <label>患者姓名或手机号</label>
            <input 
              v-model="filterParams.patientNameOrPhone" 
              type="text" 
              placeholder="输入患者姓名或手机号"
            />
          </div>
          
          <div class="filter-item">
            <label>问诊状态</label>
            <select v-model="filterParams.status">
              <option value="">请选择...</option>
              <option value="0">待支付</option>
              <option value="1">进行中</option>
              <option value="2">已完成</option>
              <option value="3">已取消</option>
              <option value="4">已退诊</option>
            </select>
          </div>
          
          <div class="filter-item">
            <label>问诊方式</label>
            <select v-model="filterParams.consultationType">
              <option value="">请选择...</option>
              <option value="1">视频问诊</option>
              <option value="2">电话问诊</option>
              <option value="3">图文问诊</option>
              <option value="4">极速电话</option>
              <option value="5">复诊开药</option>
            </select>
          </div>
          
          <div class="filter-item">
            <label>问诊来源</label>
            <select v-model="filterParams.source">
              <option value="">请选择...</option>
              <option value="1">视频问诊</option>
              <option value="2">电话问诊</option>
              <option value="3">图文问诊</option>
              <option value="4">极速图文</option>
              <option value="5">极速电话</option>
            </select>
          </div>
        </div>
        
        <div class="filter-row">
          <div class="filter-item">
            <label>日期</label>
            <div class="date-range">
              <input 
                v-model="filterParams.startTime" 
                type="datetime-local" 
                placeholder="开始时间"
              />
              <span class="date-separator">至</span>
              <input 
                v-model="filterParams.endTime" 
                type="datetime-local" 
                placeholder="结束时间"
              />
            </div>
          </div>
          
          <div class="filter-actions">
            <button class="filter-btn" @click="handleFilter">筛选</button>
          </div>
        </div>
      </div>
    </div>

    <!-- 数据列表区域 -->
    <div class="data-list-section">
      <div class="data-list-header">
        <i class="data-icon">📋</i>
        <span>数据列表</span>
      </div>
      
      <!-- 状态标签页 -->
      <div class="status-tabs">
        <button 
          v-for="tab in statusTabs" 
          :key="tab.key"
          :class="['tab-btn', { active: activeTab === tab.key }]"
          @click="handleTabChange(tab.key)"
        >
          {{ tab.label }}
          <span class="count">({{ tab.count }})</span>
        </button>
      </div>

      <!-- 数据表格 -->
      <div class="table-container">
        <table class="data-table">
          <thead>
            <tr>
              <th>
                <input 
                  type="checkbox" 
                  :checked="isAllSelected" 
                  @change="handleSelectAll"
                />
              </th>
              <th>提交问诊时间</th>
              <th>患者</th>
              <th>科室</th>
              <th>医生</th>
              <th>方式</th>
              <th>来源</th>
              <th>问诊费</th>
              <th>订单状态</th>
              <th>操作</th>
            </tr>
          </thead>
          <tbody>
            <tr v-for="order in orderList" :key="order.id">
              <td>
                <input 
                  type="checkbox" 
                  :checked="selectedOrders.includes(order.id)" 
                  @change="handleSelectOrder(order.id)"
                />
              </td>
              <td>{{ formatDateTime(order.submitTime) }}</td>
              <td>{{ order.patientName }}</td>
              <td>{{ order.departmentName }}</td>
              <td>{{ order.doctorName }}</td>
              <td>{{ order.consultationTypeText }}</td>
              <td>{{ order.sourceText }}</td>
              <td>¥{{ order.fee }}</td>
              <td>
                <span :class="['status-tag', getStatusClass(order.status)]">
                  {{ order.statusText }}
                </span>
              </td>
                             <td>
                 <div class="action-buttons">
                   <button class="action-btn view-btn" @click="viewOrderDetail(order.id)">
                     查看订单
                   </button>
                   <button 
                     v-if="order.status === 2" 
                     class="action-btn record-btn" 
                     @click="viewConsultationRecord(order.id)"
                   >
                     问诊记录
                   </button>
                 </div>
               </td>
            </tr>
          </tbody>
        </table>
      </div>

             <!-- 分页 -->
       <div class="pagination-section">
         <div class="batch-actions">
           <label>
             <input 
               type="checkbox" 
               :checked="isAllSelected" 
               @change="handleSelectAll"
             />
             全选
           </label>
         </div>
        
        <div class="pagination-info">
          共{{ pagination.totalPages }}页/{{ pagination.totalCount }}条数据
        </div>
        
        <div class="pagination-controls">
          <button 
            class="page-btn" 
            :disabled="pagination.currentPage === 1"
            @click="handlePageChange(pagination.currentPage - 1)"
          >
            &lt;
          </button>
          
          <button 
            v-for="page in visiblePages" 
            :key="page"
            :class="['page-btn', { active: page === pagination.currentPage }]"
            @click="handlePageChange(page)"
          >
            {{ page }}
          </button>
          
          <button 
            class="page-btn" 
            :disabled="pagination.currentPage === pagination.totalPages"
            @click="handlePageChange(pagination.currentPage + 1)"
          >
            &gt;
          </button>
        </div>
             </div>
     </div>

     <!-- 问诊记录模态框 -->
     <div v-if="showRecordModal" class="modal-overlay" @click="closeRecordModal">
       <div class="modal-content" @click.stop>
         <div class="modal-header">
           <h3>{{ currentRecord.doctorName }}医生</h3>
           <button class="modal-close" @click="closeRecordModal">×</button>
         </div>
         <div class="modal-body">
           <div class="chat-container">
             <div 
               v-for="message in currentRecord.messages" 
               :key="message.id"
               :class="['message', message.type]"
             >
               <div class="message-avatar">
                 <img 
                   v-if="message.type === 'doctor'" 
                   :src="message.avatar || '/doctor-avatar.png'" 
                   alt="医生头像"
                 />
                 <img 
                   v-else 
                   :src="message.avatar || '/patient-avatar.png'" 
                   alt="患者头像"
                 />
               </div>
               <div class="message-content">
                 <div class="message-text">{{ message.content }}</div>
                 <div class="message-time">{{ formatMessageTime(message.time) }}</div>
               </div>
             </div>
             <div class="consultation-end">
               {{ currentRecord.endTime }} 咨询结束
             </div>
           </div>
         </div>
       </div>
     </div>
   </div>
 </template>

<script setup lang="ts">
import { ref, computed, onMounted, watch } from 'vue'
import { useRouter } from 'vue-router'
import api from '../utils/request'

const router = useRouter()

// 响应式数据
const orderList = ref<any[]>([])
const selectedOrders = ref<number[]>([])
const activeTab = ref('all')
const loading = ref(false)

// 问诊记录模态框相关
const showRecordModal = ref(false)
const currentRecord = ref<{
  doctorName: string;
  endTime: string;
  messages: Array<{
    id: number;
    type: 'doctor' | 'patient';
    content: string;
    time: string;
    avatar?: string;
  }>;
}>({
  doctorName: '',
  endTime: '',
  messages: []
})

// 筛选参数
const filterParams = ref<{
  patientNameOrPhone: string;
  status: string;
  consultationType: string;
  source: string;
  startTime: string;
  endTime: string;
  pageIndex: number;
  pageSize: number;
}>({
  patientNameOrPhone: '',
  status: '',
  consultationType: '',
  source: '',
  startTime: '',
  endTime: '',
  pageIndex: 1,
  pageSize: 10
})

// 分页信息
const pagination = ref({
  totalCount: 0,
  totalPages: 0,
  currentPage: 1,
  pageSize: 10
})

// 统计数据
const statistics = ref({
  totalCount: 0,
  pendingPaymentCount: 0,
  inProgressCount: 0,
  completedCount: 0,
  cancelledCount: 0,
  refundedCount: 0
})

// 计算属性
const isAllSelected = computed(() => {
  return orderList.value.length > 0 && selectedOrders.value.length === orderList.value.length
})

const statusTabs = computed(() => [
  { key: 'all', label: '全部', count: statistics.value.totalCount },
  { key: '0', label: '待支付', count: statistics.value.pendingPaymentCount },
  { key: '1', label: '进行中', count: statistics.value.inProgressCount },
  { key: '2', label: '已完成', count: statistics.value.completedCount },
  { key: '3', label: '已取消', count: statistics.value.cancelledCount },
  { key: '4', label: '已退诊', count: statistics.value.refundedCount }
])

const visiblePages = computed(() => {
  const pages = []
  const current = pagination.value.currentPage
  const total = pagination.value.totalPages
  
  if (total <= 10) {
    for (let i = 1; i <= total; i++) {
      pages.push(i)
    }
  } else {
    if (current <= 5) {
      for (let i = 1; i <= 10; i++) {
        pages.push(i)
      }
    } else if (current >= total - 4) {
      for (let i = total - 9; i <= total; i++) {
        pages.push(i)
      }
    } else {
      for (let i = current - 4; i <= current + 5; i++) {
        pages.push(i)
      }
    }
  }
  
  return pages
})

// 方法
const loadOrderList = async () => {
  try {
    loading.value = true
    
    // 构建查询参数
    const params = { ...filterParams.value }
    
    // 处理状态筛选
    if (activeTab.value !== 'all') {
      params.status = activeTab.value
    }
    
    // 处理时间格式
    if (params.startTime) {
      params.startTime = new Date(params.startTime).toISOString()
    }
    if (params.endTime) {
      params.endTime = new Date(params.endTime).toISOString()
    }
    
    try {
          const response: any = await api.consultationOrder.getPagedList(params)
    
    if (response.code === 200) {
        orderList.value = response.data.items
        pagination.value = {
          totalCount: response.data.totalCount,
          totalPages: response.data.totalPages,
          currentPage: response.data.currentPage,
          pageSize: response.data.pageSize
        }
      }
    } catch (error) {
      console.error('加载问诊单列表失败:', error)
      // 使用模拟数据
      orderList.value = [
        {
          id: 40,
          orderNo: "C020250801040",
          submitTime: "2025-07-31T21:31:02",
          patientName: "患者1",
          patientPhone: "13800138001",
          departmentName: "外科",
          doctorName: "医生5",
          consultationTypeText: "复诊开药",
          sourceText: "极速电话",
          fee: 60,
          status: 3,
          statusText: "已取消",
          createdAt: "2025-07-31T21:31:02"
        },
        {
          id: 47,
          orderNo: "C020250801047",
          submitTime: "2025-07-31T21:31:02",
          patientName: "患者3",
          patientPhone: "13800138003",
          departmentName: "妇科",
          doctorName: "医生2",
          consultationTypeText: "视频问诊",
          sourceText: "图文问诊",
          fee: 30,
          status: 1,
          statusText: "进行中",
          createdAt: "2025-07-31T21:31:02"
        }
      ]
      pagination.value = {
        totalCount: 100,
        totalPages: 10,
        currentPage: 1,
        pageSize: 10
      }
    }
  } finally {
    loading.value = false
  }
}

const loadStatistics = async () => {
  try {
    const response: any = await api.consultationOrder.getStatistics()
    
    if (response.code === 200) {
      statistics.value = response.data
    }
  } catch (error) {
    console.error('加载统计数据失败:', error)
    // 使用模拟数据
    statistics.value = {
      totalCount: 100,
      pendingPaymentCount: 20,
      inProgressCount: 15,
      completedCount: 45,
      cancelledCount: 10,
      refundedCount: 10
    }
  }
}

const handleFilter = () => {
  filterParams.value.pageIndex = 1
  loadOrderList()
}

const handleTabChange = (tabKey: string) => {
  activeTab.value = tabKey
  filterParams.value.pageIndex = 1
  loadOrderList()
}

const handlePageChange = (page: number) => {
  filterParams.value.pageIndex = page
  loadOrderList()
}

const handleSelectAll = (event: Event) => {
  const checked = (event.target as HTMLInputElement).checked
  if (checked) {
    selectedOrders.value = orderList.value.map(order => order.id)
  } else {
    selectedOrders.value = []
  }
}

const handleSelectOrder = (orderId: number) => {
  const index = selectedOrders.value.indexOf(orderId)
  if (index > -1) {
    selectedOrders.value.splice(index, 1)
  } else {
    selectedOrders.value.push(orderId)
  }
}

const viewOrderDetail = (orderId: number) => {
  // 所有状态都跳转到同一个详情页面，通过API获取数据
  router.push(`/consultation-order-detail/${orderId}`)
}

const viewConsultationRecord = async (orderId: number) => {
  try {
    // 获取问诊记录数据
    const response: any = await api.consultationOrder.getDetail(orderId)
    
    if (response.code === 200) {
      // 模拟问诊记录数据
      currentRecord.value = {
        doctorName: '张三',
        endTime: '2020-04-05 10:40:20',
        messages: [
          {
            id: 1,
            type: 'patient',
            content: '病症描述:最近四个月左膝盖总是隐隐的疼,特别是晚上,去医院检查说是轻度硬化,请问吃药需要多长时间能有改善?',
            time: '今天 10:20'
          },
          {
            id: 2,
            type: 'doctor',
            content: '您好,您这种情况是由于平时过度劳累造成的损伤。',
            time: '10:25'
          },
          {
            id: 3,
            type: 'patient',
            content: '请问我怎样做才能改善?',
            time: '10:30'
          },
          {
            id: 4,
            type: 'doctor',
            content: '建议减少蹲下起来的活动,减少久站时间,少上下楼梯,然后平时多热敷,一般能自行恢复,平常补钙',
            time: '10:40'
          }
        ]
      }
      showRecordModal.value = true
    }
  } catch (error) {
    console.error('获取问诊记录失败:', error)
    // 使用模拟数据
    currentRecord.value = {
      doctorName: '张三',
      endTime: '2020-04-05 10:40:20',
      messages: [
        {
          id: 1,
          type: 'patient',
          content: '病症描述:最近四个月左膝盖总是隐隐的疼,特别是晚上,去医院检查说是轻度硬化,请问吃药需要多长时间能有改善?',
          time: '今天 10:20'
        },
        {
          id: 2,
          type: 'doctor',
          content: '您好,您这种情况是由于平时过度劳累造成的损伤。',
          time: '10:25'
        },
        {
          id: 3,
          type: 'patient',
          content: '请问我怎样做才能改善?',
          time: '10:30'
        },
        {
          id: 4,
          type: 'doctor',
          content: '建议减少蹲下起来的活动,减少久站时间,少上下楼梯,然后平时多热敷,一般能自行恢复,平常补钙',
          time: '10:40'
        }
      ]
    }
    showRecordModal.value = true
  }
}

const closeRecordModal = () => {
  showRecordModal.value = false
}

const formatMessageTime = (time: string) => {
  return time
}



const getStatusClass = (status: number) => {
  switch (status) {
    case 0: return 'pending'
    case 1: return 'in-progress'
    case 2: return 'completed'
    case 3: return 'cancelled'
    case 4: return 'refunded'
    default: return ''
  }
}

const formatDateTime = (dateTime: string) => {
  if (!dateTime) return ''
  return new Date(dateTime).toLocaleString('zh-CN')
}

// 监听筛选参数变化
watch(filterParams, () => {
  // 重置选中状态
  selectedOrders.value = []
}, { deep: true })

onMounted(() => {
  loadOrderList()
  loadStatistics()
})
</script>

<style scoped>
.consultation-order-management {
  padding: 20px;
  min-height: calc(100vh - 120px);
  background: #f5f5f5;
}

.page-header {
  margin-bottom: 20px;
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.page-header h2 {
  margin: 0 0 10px 0;
  color: #333;
  font-size: 24px;
  font-weight: 600;
}

.page-header p {
  margin: 0;
  color: #666;
  font-size: 14px;
}

.filter-section {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
  overflow: hidden;
}

.filter-header {
  background: #f8f9fa;
  padding: 15px 20px;
  border-bottom: 1px solid #e9ecef;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #333;
}

.filter-icon {
  font-size: 16px;
}

.filter-content {
  padding: 20px;
}

.filter-row {
  display: flex;
  gap: 20px;
  margin-bottom: 15px;
  align-items: flex-end;
}

.filter-row:last-child {
  margin-bottom: 0;
}

.filter-item {
  flex: 1;
  min-width: 200px;
}

.filter-item label {
  display: block;
  margin-bottom: 5px;
  font-size: 14px;
  color: #333;
  font-weight: 500;
}

.filter-item input,
.filter-item select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  outline: none;
}

.filter-item input:focus,
.filter-item select:focus {
  border-color: #1890ff;
}

.date-range {
  display: flex;
  align-items: center;
  gap: 10px;
}

.date-range input {
  flex: 1;
}

.date-separator {
  color: #666;
  font-size: 14px;
}

.filter-actions {
  display: flex;
  align-items: flex-end;
}

.filter-btn {
  padding: 8px 20px;
  background: #1890ff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.3s;
}

.filter-btn:hover {
  background: #40a9ff;
}

.data-list-section {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.data-list-header {
  background: #f8f9fa;
  padding: 15px 20px;
  border-bottom: 1px solid #e9ecef;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #333;
}

.data-icon {
  font-size: 16px;
}

.status-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid #e9ecef;
  background: #f8f9fa;
}

.tab-btn {
  padding: 12px 20px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 14px;
  color: #666;
  border-bottom: 2px solid transparent;
  transition: all 0.3s;
  flex: 1;
  text-align: center;
}

.tab-btn:hover {
  background: #e6f7ff;
  color: #1890ff;
}

.tab-btn.active {
  background: #e6f7ff;
  color: #1890ff;
  border-bottom-color: #1890ff;
}

.tab-btn .count {
  font-size: 12px;
  opacity: 0.8;
  margin-left: 4px;
}

.table-container {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
}

.data-table th {
  background: #fafafa;
  font-weight: 600;
  color: #333;
}

.data-table tbody tr:hover {
  background: #f5f5f5;
}

.status-tag {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.status-tag.pending {
  background: #fff7e6;
  color: #fa8c16;
}

.status-tag.in-progress {
  background: #e6f7ff;
  color: #1890ff;
}

.status-tag.completed {
  background: #f6ffed;
  color: #52c41a;
}

.status-tag.cancelled {
  background: #fff2f0;
  color: #ff4d4f;
}

.status-tag.refunded {
  background: #f0f5ff;
  color: #722ed1;
}

.action-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.action-btn {
  padding: 4px 8px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.3s;
}

.view-btn {
  background: #1890ff;
  color: white;
}

.view-btn:hover {
  background: #40a9ff;
}

.record-btn {
  background: #52c41a;
  color: white;
}

.record-btn:hover {
  background: #73d13d;
}

.pagination-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-top: 1px solid #e9ecef;
  background: #f8f9fa;
}

.batch-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}

.batch-actions label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  color: #333;
  cursor: pointer;
}



.pagination-info {
  font-size: 14px;
  color: #666;
}

.pagination-controls {
  display: flex;
  gap: 5px;
}

.page-btn {
  padding: 6px 12px;
  border: 1px solid #d9d9d9;
  background: white;
  color: #666;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s;
  min-width: 32px;
}

.page-btn:hover:not(:disabled) {
  border-color: #1890ff;
  color: #1890ff;
}

.page-btn.active {
  background: #1890ff;
  border-color: #1890ff;
  color: white;
}

.page-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

@media (max-width: 768px) {
  .filter-row {
    flex-direction: column;
    gap: 15px;
  }
  
  .filter-item {
    min-width: auto;
  }
  
  .status-tabs {
    flex-wrap: wrap;
  }
  
  .tab-btn {
    flex: none;
    min-width: 80px;
  }
  
  .pagination-section {
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
  }
  
  .pagination-controls {
    justify-content: center;
  }
  
  .data-table {
    font-size: 12px;
  }
  
     .data-table th,
   .data-table td {
     padding: 8px 10px;
   }
 }

 /* 模态框样式 */
 .modal-overlay {
   position: fixed;
   top: 0;
   left: 0;
   right: 0;
   bottom: 0;
   background: rgba(0, 0, 0, 0.5);
   display: flex;
   justify-content: center;
   align-items: center;
   z-index: 1000;
 }

 .modal-content {
   background: white;
   border-radius: 8px;
   width: 90%;
   max-width: 600px;
   max-height: 80vh;
   overflow: hidden;
   box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
 }

 .modal-header {
   display: flex;
   justify-content: space-between;
   align-items: center;
   padding: 20px;
   border-bottom: 1px solid #e9ecef;
   background: #f8f9fa;
 }

 .modal-header h3 {
   margin: 0;
   font-size: 18px;
   font-weight: 600;
   color: #333;
 }

 .modal-close {
   background: none;
   border: none;
   font-size: 24px;
   color: #666;
   cursor: pointer;
   padding: 0;
   width: 30px;
   height: 30px;
   display: flex;
   align-items: center;
   justify-content: center;
   border-radius: 4px;
   transition: all 0.3s;
 }

 .modal-close:hover {
   background: #e9ecef;
   color: #333;
 }

 .modal-body {
   padding: 0;
   max-height: calc(80vh - 80px);
   overflow-y: auto;
 }

 .chat-container {
   padding: 20px;
 }

 .message {
   display: flex;
   margin-bottom: 20px;
   gap: 12px;
 }

 .message.patient {
   flex-direction: row-reverse;
 }

 .message.doctor {
   flex-direction: row;
 }

 .message-avatar {
   width: 40px;
   height: 40px;
   border-radius: 50%;
   overflow: hidden;
   flex-shrink: 0;
 }

 .message-avatar img {
   width: 100%;
   height: 100%;
   object-fit: cover;
 }

 .message-content {
   flex: 1;
   max-width: 70%;
 }

 .message.patient .message-content {
   text-align: right;
 }

 .message-text {
   background: #f0f2f5;
   padding: 12px 16px;
   border-radius: 18px;
   font-size: 14px;
   line-height: 1.5;
   color: #333;
   word-wrap: break-word;
 }

 .message.doctor .message-text {
   background: #e6f7ff;
   color: #1890ff;
 }

 .message.patient .message-text {
   background: #f0f2f5;
   color: #333;
 }

 .message-time {
   font-size: 12px;
   color: #999;
   margin-top: 4px;
   padding: 0 4px;
 }

 .consultation-end {
   text-align: center;
   color: #999;
   font-size: 12px;
   margin-top: 30px;
   padding: 10px;
   border-top: 1px solid #f0f0f0;
 }

 @media (max-width: 768px) {
   .modal-content {
     width: 95%;
     max-height: 90vh;
   }
   
   .message-content {
     max-width: 85%;
   }
   
   .chat-container {
     padding: 15px;
   }
 }
 </style> 